%%%%%add missing%%%%%%%%%%%%%%
% missRate = 0.9;
% [N,L] = size(Y_tr);
% Y_tr(find((rand(N,L)<missRate))) = -1;

Y_trorig = Y_tr;
[N, L] = size(Y_tr);
missRate = 0.8;
for  i =1:N
    idx = randperm(L);
    idx = idx(1:ceil(missRate*L));
    Y_tr(i,idx) = -1;
end

for  i = 1:N
    id(i) = numel(find(Y_tr(i,:)==1));
    if id(i)==0
        temp = find(Y_trorig(i,:)==1);
        if numel(temp)>0
            Y_tr(i,temp(1)) = 1;
        end
    end
end



%    rankR1MP = crossvalR1MP(X_tr, Y_tr, X_val, Y_val);
%    rankLEML = crossvalLEML(X_tr,Y_tr, X_val, Y_val);

[out1.top1,out1.top3,out1.obj,ou1.objTs, out1.time,out1.iter]  = R1MP_f_missing( X_tr, Y_tr, X_ts, Y_ts,200);
[out3.top1,out3.top3,out3.obj,out3.objTs, out3.time,out3.iter]  = R1MP_f_missing_UV( X_tr, Y_tr, X_ts, Y_ts,200)
    
[out2.top1,out2.top3,out2.obj,out2.objTs, out2.time,out2.iter]  = LEML_missing( X_tr, Y_tr, X_ts, Y_ts,45, 20);
%  [out3.top1,out3.top3,out3.obj,out3.time] = BR( Y_tr, X_tr, X_ts, Y_ts );


%%%emotions [300,6]. 80%
%%%scene  [200,6]    50%
%% medical [450, 64] 50%